$(".productGrid a").click(function () {
    let b = $(this).find(".info").html();
    console.log(b);
    location.href = "../information/information.html?id=" + b;
});

// 可拖动的进度条
var scroll = document.getElementById('scroll');
var bar = document.getElementsByClassName('bar');
// var mask = document.getElementById('mask');  
// var ptxt = document.getElementById("progressBar");
var barleft = 0;
// ------------------------------------------------------------
for (let i = 0; i < bar.length; i++) {
    bar[i].onmousedown = function (e) {
        var e = e || window.event;
        var leftVal = e.clientX - this.offsetLeft;
        var that = this;
        document.onmousemove = function (e) {
            var e = e || window.event;
            barleft = e.clientX - leftVal;
            if (barleft < 0) {
                barleft = 0;
            } else if (barleft > scroll.offsetWidth - bar[i].offsetWidth) {
                barleft = scroll.offsetWidth - bar[i].offsetWidth;
            }
            // mask.style.width = barleft + 'px';
            that.style.left = barleft + "px";
            if (!i % 2) {
                $("input[value='799']").val(parseInt(barleft / (scroll.offsetWidth - bar[i].offsetWidth) * 100 * 18) + 799);
            } else {
                $("input[value='2599']").val(parseInt(barleft / (scroll.offsetWidth - bar[i].offsetWidth) * 100 * 18) + 799);
            }
            // ptxt.innerHTML = "已经走了" + parseInt(barleft/(scroll.offsetWidth-bar.offsetWidth) * 100) + "%";
        }
        // 双击禁止选择文字
        window.getSelection ? window.getSelection().removeAllRanges() : document.selection.empty();
    }
    document.onmouseup = function () {
        document.onmousemove = null; //弹起鼠标不做任何操作
    }
}

// 筛选条件
$("span:contains('寸')").prev().click(function () {
    $(this).toggleClass("iactive");
});

$("span:contains('寸')").prev().click(function () {
    console.log($(this).next().html().split("寸")[0]);
});


$.get("../rearEnd/goodsAndShoppingCart/getGoodsList.php", function (data) {
    let listObj = data;

    console.log(JSON.parse(listObj));
    for (let i = 0; i < $(".info").length; i++) {
        // console.log(JSON.parse(listObj)[i].goodsId);

        $(".info").eq(i).html("OCX6" + JSON.parse(listObj)[i].goodsId);
        $(".goodTitle strong").eq(i).html(JSON.parse(listObj)[i].goodsName);
        $(".goodTitle p").eq(i).html("￥" + JSON.parse(listObj)[i].goodsPrice);
        $(".maxImg img").eq(i).attr("src", JSON.parse(listObj)[i].goodsImg);

        console.log(JSON.parse(listObj)[i].beiyong1);
        
    }
});

$("span:contains('寸')").prev().click(function () {
    for(let i=0;i<$(".info").length;i++){
        
            console.log(JSON.parse(listObj)[i]);
            console.log(111222333);
    }
});